package com.atguigu05.map;

import org.junit.Test;

import java.time.LocalDate;
import java.util.*;

public class MapTest {
    @Test
    public void t1(){
        Map map=new HashMap();
        map.put(null,null);
        System.out.println(map);
    }
    @Test
    public void t2(){
        Map map=new Hashtable();
//        map.put(null,null); //error
//        map.put(null,123);//error
        System.out.println(map);
    }

    @Test
    public void t3(){
        Map map=new HashMap();
        map.put("tom",45);
        map.put("obo",123);
        System.out.println(map);
    }

    @Test
    public  void t4(){
       // Set set=new HashSet();
        Map map=new HashMap();
        map.put(12,"dsa");
        map.put(14,"dsa");
        map.put(1,"dsa");
        Set entrySet = map.entrySet();
        Iterator iterator = entrySet.iterator();
        while(iterator.hasNext()){
              //方式1:
           // System.out.println(iterator.next());
            //方式2:
            Map.Entry entry = (Map.Entry) iterator.next();
            System.out.println(entry.getKey() + "--->" + entry.getValue());

        }

    }

    @Test
    public void test(){
        LocalDate localDate1=LocalDate.of(2023,9,7);
        LocalDate localDate2=localDate1.plusDays(100);
        System.out.println(localDate2.toString());
    }
}
